import java.util.*;

//TIP To <b>Run</b> code, press <shortcut actionId="Run"/> or
// click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter.
public class Main {
    public static void main(String[] args) {
        Set<Integer> treeSet = new TreeSet<>();
        treeSet.add(1);
        treeSet.add(9);
        treeSet.add(5);
        treeSet.add(3);

        System.out.println(Arrays.toString(treeSet.toArray()));
        Iterator<Integer> it = treeSet.iterator();
        while(it.hasNext()){
            System.out.print(it.next() + " ");
        }
        System.out.println();
    }
    public static void main2(String[] args) {
        Map<String,Integer> map = new TreeMap<>();
        map.put("hello",5);
        map.put("world",7);
        System.out.println(map.get("hello"));
        System.out.println(map.get("a"));
        System.out.println(map.getOrDefault("a",8));
        //int a = map.get("a");
        Integer A = map.get("a");
        System.out.println(A);

        Set<String> set = map.keySet();
        System.out.println(set);

        for(Map.Entry<String,Integer> s: map.entrySet()){
            System.out.println("key: "+s.getKey() +" val: "+s.getValue());
        }

    }
    public static void main1(String[] args) {
        int[] array = {5,3,4,1,7,8,2,6,0,9};
        BinarySearchTree bst = new BinarySearchTree();
        for (int i = 0; i < array.length; i++) {
            bst.insert(array[i]);
        }
        bst.remove(7);

    }
}